/*************************************************************************
 * AUTHOR		 : Chris Hayes
 * STUDENT ID	 : 656960
 * ASSIGNMENT #5 : Multi-Dimensional Array - Tic Tac Toe
 * CLASS		 : CS1B
 * SECTION		 : MW12:30
 * DUE DATE		 : June 15, 2011
 *************************************************************************/

#include "tictacheader.h"

/**************************************************************************
* FUNCTION DisplayBoard
*__________________________________________________________________________
* This function receives a multi-dimensional array which contains the
*  locations which have and have not been played.  It then outputs to the
*  console a TicTacToe board with tokens filling in the appropriate spots
*  on the board.
*__________________________________________________________________________
* PRE-CONDITIONS
*  board : Needs to be previously defined
*
* POST-CONDITIONS
*   There are no post-conditions for this function.
*
**************************************************************************/

void DisplayBoard(const char board[][NUM_COLS])
{

	cout << setw(10) << "1" << setw(8) << "2" << setw(9) << "3\n";
	for (int i=0; i < 3; i++)
	{
		cout << setw(7)<< "[" << i+1 << "][1] | " << "[" << i+1;
		cout << "][2] | " << "[" << i+1 << "][3]" << endl;
		cout << setw(14)<< "|" << setw(9) << "|" << endl;

		for (int j = 0; j <3; j++)
		{
			switch(j)
			{
			case 0: cout << i + 1 << setw(9) << board[i][j];
					cout << setw(4) << "|";
					break;

			case 1: cout << setw(4) << board[i][j];
					cout << setw(5) << "|";
					break;

			case 2: cout << setw(4) << board[i][j] << endl;
					break;

			default: cout << "ERROR!\n\n";
			}
		}

		cout << setw(14) << "|" << setw(10) << "|\n";

		if (i != 2)
		{
			cout << setw(32) << "--------------------------\n";
		}
	}

	cout << endl << endl;
}
